<template>
	<div>
		<el-table :data="tableData" border style="width: 100%">
			<el-table-column prop="name" label="名字" width="180"></el-table-column>
			<el-table-column prop="pwd" label="密码" width="180"></el-table-column>
			<el-table-column prop="sex" label="性别"></el-table-column>
		</el-table>
		<el-pagination
		  background
		  layout="prev, pager, next"
		  :total="total"
		  :page-size="pageSize"
		  @current-change="getNow">
		</el-pagination>
	</div>
</template>

<script>
export default {
	data() {
		return {
			tableData: [],
			total:0,
			pageSize:2,
			pageNow:1
		};
	},
	created() {
		this.getPage();
	},
	methods:{
		getPage: function() {
			var _this = this;
			_this.$ajax
				.get('http://1319.cc/aa', {
					params: {
						page:_this.pageNow
					}
				})
				.then(function(response) {
					// console.log(response.data.data.data);
					_this.tableData=response.data.data.data
					_this.total=response.data.data.total
				})
				.catch(function(error) {
					console.log(error);
				});
		},
		getNow:function(a){
			this.pageNow=a
			this.getPage();
		}
	}
};
</script>

<style></style>
